/*
 * Copyright (c) ShaoxiongDu <Shaoxiong.dev@aliyun.com> 2021 all Rights Reserved
 */

package zh.codegym.task.task08.task0802;

/* 
包含 10 个对的 HashMap
*/

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class Solution {
    public static void main(String[] args) throws Exception {
        //在此编写你的代码
        HashMap<String, String> hashMap = new HashMap<String, String>();
        hashMap.put("西瓜", "瓜");
        hashMap.put("香蕉", "水果");
        hashMap.put("樱桃", "水果");
        hashMap.put("梨", "水果");
        hashMap.put("哈密瓜", "瓜");
        hashMap.put("黑莓", "水果");
        hashMap.put("人参", "根");
        hashMap.put("草莓", "水果");
        hashMap.put("鸢尾花", "花");
        hashMap.put("土豆", "块茎");

        Set<Map.Entry<String, String>> entries = hashMap.entrySet();
        Iterator<Map.Entry<String, String>> iterator = entries.iterator();
        while (iterator.hasNext()) {
            Map.Entry<String, String> next = iterator.next();
            String key = next.getKey();
            String value = next.getValue();
            System.out.println(key + " - " + value);
        }

    }
}
